<?php
require '../vendor/autoload.php';
//设置自动加载类的文件夹
spl_autoload_register(function ($classname) {
    require ("../classes/" . $classname . ".php");
});
//加载默认配置文件container.config.php
$app = new Slim\App(
    new \Slim\Container(
        include '../config/container.config.php'
    )
);

$container = $app->getContainer();

$app->get('/logout', '\HomeController:logout');

$app->map(['GET','POST'],'/', '\HomeController:index');

//添加验证session的中间件
$app->group('/disease', function () {
	$this->get('', '\DiseaseController');
    $this->map(['GET','POST'], '/add','\DiseaseController:add');
    $this->map(['GET','POST'], '/edit/{id:[0-9]+}','\DiseaseController:edit');
})->add(new AuthMiddleware());


$app->run();